package com.situ.mall.base.mapper;

import com.situ.mall.base.entity.Attachment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author darling
 * @since 2023-03-21
 */
public interface AttachmentMapper extends BaseMapper<Attachment> {

    @Select("SELECT * FROM t_attachment WHERE  source = #{source} AND source_id = #{sourceId}")
    List<Attachment> getList(@Param("sourceId") Integer sourceId, @Param("source") String source);

    @Update("UPDATE t_attachment SET source_id = #{sourceId} WHERE id = #{id}")
    void updateSelect(@Param("id") Integer id, @Param("sourceId") Integer sourceId);

    List<Attachment> getBySourceAndSourceId(@Param("source") String source, @Param("sourceId") Integer sourceId);


}
